#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
struct people
{
	char name[20];
	int age;
};
int comp_name(const void* p1, const void* p2)
{
	return strcmp(((struct people*)p1)->name, ((struct people*)p2)->name);
}
int comp_age(const void* p1, const void* p2)
{
	return ((struct people*)p1)->age - ((struct people*)p2)->age;
}

int main()
{
	struct people stus[4] = { {"fkaejfn",13},{"aefkn",18},{"kajavg",2},{"hiaufir",10}};
	int sz = sizeof(stus) / sizeof(stus[0]);
	qsort(stus, sz, sizeof(stus[0]), comp_name);
	for (int i = 0; i < 4; i++) {
		printf("%s\n", stus[i].name);
	}
	qsort(stus, sz, sizeof(stus[0]), comp_age);
	for (int i = 0; i < 4; i++) {
		printf("%d\n", stus[i].age);
	}
	return 0;
}